from typing import NamedTuple
from dataclasses import dataclass

# 使用命名元组
Point = NamedTuple('Point', [('x', float), ('y', float)])

# 使用不可变数据类
@dataclass(frozen=True)
class Circle:
    """不可变的圆类"""
    center: Point
    radius: float

    def scale(self, factor: float) -> 'Circle':
        """返回新的Circle实例而不是修改现有实例"""
        return Circle(self.center, self.radius * factor)

c1 = Circle(center=Point(x=0, y=0), radius=1)    
c2 = c1.scale(factor=2)

print(c1)
print(c2)
print(c1 == c2)